package engine.systems.motion.randomDrift
{
	import engine.classes.enumerations.SystemPriority;
	import engine.groups.Group;
	import engine.systems.update.GameSystem;
	
	public class RandomDriftSystem extends GameSystem
	{
		public function RandomDriftSystem()
		{
			super(RandomDriftNode, updateNode);
			
			this.priority = SystemPriority.PRE_MOTION;
		}
		
		private function updateNode(node:RandomDriftNode, time:Number):void
		{
			node.motion.velocityX += (Math.random() - 0.5) * node.drift.driftX * 2 * time;
			node.motion.velocityY += (Math.random() - 0.5) * node.drift.driftY * 2 * time;
		}
	}
}